﻿package {
	import flash.events.MouseEvent;	
	import flash.display.Sprite;	
	
	import jojo.bitmapRenderer.SpriteAnim;	
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.BitmapData;
	import flash.display.Bitmap;
	import flash.display.SimpleButton;
	

	/**
	 * ...
	 * @author jo
	 */
	public class Main extends MovieClip 
	{
		
		private var coord:int = 0;
		private var spriteAnim : SpriteAnim;
		
		public function Main() {
			
			//var testMc = new TestMc();
			//this.addChild(testMc);
			
			var animArr : Array = SpriteAnim.copyAnimation(new TestMc());

			spriteAnim = new SpriteAnim(animArr,false,200,100);
			//spriteAnim.addCopy(animArr);
			this.addChild(spriteAnim);
			
			
			play_mc.addEventListener(MouseEvent.CLICK, onPlay);
			stop_mc.addEventListener(MouseEvent.CLICK, onStop);
			
			
			//var animSprite:SpriteAnim = new SpriteAnim(testMc);
			//this.addChild(animSprite);
			
			//testMc_animCopy = SpriteAnim.copyMcAnimation2(testMc);
			//testMc = null;
			//copier();
			
			/*
			var mcBitmapData:BitmapData = new BitmapData(this.stage.stageWidth, this.stage.stageHeight, true,0xFF555555);
			mcBitmapData.draw(this);			
			var stageBmp:Bitmap = new Bitmap(mcBitmapData);
			this.addChild(stageBmp);
			stageBmp.x = stageBmp.y = 0;
			trace(this.stage.width);
			 */
		}
		
		public function onPlay(e : MouseEvent){
			spriteAnim.play();
			//spriteAnim.gotoAndPlay(30);
			//spriteAnim.gotoAndPlay("L15");
		}

		public function onStop(e : MouseEvent){
			spriteAnim.stop();
			//spriteAnim.gotoAndStop(5);
			//spriteAnim.gotoAndStop("L15");
		}
		
		public function copier() {
			/*var testMc = new TestMc();
			var arr:Array = new Array;
			for (var i:Number = 1; i <= 5; i++) { 
			/*	arr[i] = new TestMc()
				this.addChild(arr[i]);
				arr[i] = new SpriteAnim(testMc);
				this.addChild(arr[i]);	
				
				coord=coord+20;
				
				arr[i].x = coord;
				arr[i].y = coord;
			} */
			//this.addChild(new SpriteAnim(this.stage));
		}
		
	}
	
}